package com.project.business.component;

import java.util.List;

import org.springframework.jdbc.core.BeanPropertyRowMapper;

import com.project.bean.MovieBase;
import com.project.business.component.tool.DBOperate;
import com.project.model.jdbc.DataSourceSwitcher;

public class DBComponent {

	private DBOperate dbOperate;

	@SuppressWarnings("unchecked")
	public List getUserInfor() throws Exception {
		DataSourceSwitcher.setSlave();
		String sql = "select * from pocket_movie where name like ? ";
		Object[] objects = new Object[] { "%爱%" };
		List<MovieBase> list = dbOperate.query(sql, new BeanPropertyRowMapper(
				MovieBase.class), objects);
		// for (int i = 0; i < list.size(); i++) {
		// MovieBase base = (MovieBase) MapBeanCovert.convertMap(
		// MovieBase.class, list.get(i));
		// System.out.println(base.getName());
		// }
		// List<String> aList=dbOperate.queryForList(sql,"111");
		return list;
	}

	public DBOperate getDbOperate() {
		return dbOperate;
	}

	public void setDbOperate(DBOperate dbOperate) {
		this.dbOperate = dbOperate;
	}

	// public
}
